package com.xiaominfo.swagger.service.user;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@EnableEurekaClient
@SpringBootApplication
public class ServiceUserApplication
{
    static Logger logger = LoggerFactory.getLogger(ServiceUserApplication.class);
    
    public static void main(String[] args)
        throws UnknownHostException
    {
        ConfigurableApplicationContext application = SpringApplication.run(ServiceUserApplication.class, args);
        Environment env = application.getEnvironment();
        logger.info(
            "\n----------------------------------------------------------\n\t" + "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:{}\n\t" + "External: \thttp://{}:{}\n\t" + "Doc: \thttp://{}:{}/doc.html\n"
                + "----------------------------------------------------------",
            env.getProperty("spring.application.name"),
            env.getProperty("server.port"),
            InetAddress.getLocalHost().getHostAddress(),
            env.getProperty("server.port"),
            InetAddress.getLocalHost().getHostAddress(),
            env.getProperty("server.port"));
    }
}
